﻿<Activity mc:Ignorable="sap" x:Class="Reactor.ServiceGrid.Workflows.OrphanServiceWorkflow" 
          xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" 
          xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
          xmlns:l="clr-namespace:log4net;assembly=log4net" 
          xmlns:lc="clr-namespace:log4net.Core;assembly=log4net" 
          xmlns:local="clr-namespace:Reactor.ServiceGrid.Workflows.Activities" 
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
          xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" 
          xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" 
          xmlns:rc="clr-namespace:Reactor.Configuration;assembly=Reactor" 
          xmlns:re="clr-namespace:Reactor.Environment;assembly=Reactor" 
          xmlns:rl="clr-namespace:Reactor.Logging;assembly=Reactor" 
          xmlns:rm="clr-namespace:Reactor.Messages;assembly=Reactor.Messages" 
          xmlns:rmea="clr-namespace:Reactor.Messages.Events.Adoptions;assembly=Reactor.Messages" 
          xmlns:rmefa="clr-namespace:Reactor.Messages.Events.Failures.Adoption;assembly=Reactor.Messages" 
          xmlns:rp="clr-namespace:Reactor.Providers;assembly=Reactor" 
          xmlns:rs="clr-namespace:Reactor.ServiceGrid" 
          xmlns:rwa="clr-namespace:Reactor.Workflow.Activities" 
          xmlns:s="clr-namespace:System;assembly=mscorlib" 
          xmlns:s1="clr-namespace:System;assembly=System" 
          xmlns:s2="clr-namespace:System;assembly=System.Xml" 
          xmlns:s3="clr-namespace:System;assembly=System.Core" 
          xmlns:s4="clr-namespace:System;assembly=System.ComponentModel.Composition" 
          xmlns:s5="clr-namespace:System;assembly=Reactor" 
          xmlns:s6="clr-namespace:System;assembly=System.ServiceModel" 
          xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" 
          xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" 
          xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" 
          xmlns:scg="clr-namespace:System.Collections.Generic;assembly=Samurai.Wakizashi" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg4="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:scg5="clr-namespace:System.Collections.Generic;assembly=Reactor" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:si="clr-namespace:System.IO;assembly=mscorlib" xmlns:si1="clr-namespace:System.IO;assembly=System" xmlns:si2="clr-namespace:System.IO;assembly=System.Core" xmlns:si3="clr-namespace:System.IO;assembly=Reactor" xmlns:si4="clr-namespace:System.IO;assembly=System.ServiceModel" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:ss="clr-namespace:System.ServiceProcess;assembly=System.ServiceProcess" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="ServiceIdentifier" Type="InArgument(rs:ServiceIdentifier)" />
    <x:Property Name="ServiceInstanceIdentifier" Type="InArgument(s:Guid)" />
  </x:Members>
  <sap:VirtualizedContainerService.HintSize>684,950</sap:VirtualizedContainerService.HintSize>
  <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
  <Flowchart DisplayName="Orphan Service Flowchart" sad:XamlDebuggerXmlReader.FileName="C:\Projects\Reactor\Platform Source\trunk\Reactor.ServiceGrid\Reactor.ServiceGrid\Workflows\OrphanService.xaml" sap:VirtualizedContainerService.HintSize="614,636">
    <Flowchart.Variables>
      <Variable x:TypeArguments="rmea:ServiceOrphaned" Name="OrphanedEventMessage" />
      <Variable x:TypeArguments="rmefa:OrphanFailed" Name="OrphanFailureEventMessage" />
      <Variable x:TypeArguments="x:String" Name="TargetServiceInstallPath" />
    </Flowchart.Variables>
    <sap:WorkflowViewStateService.ViewState>
      <scg4:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">False</x:Boolean>
        <av:Point x:Key="ShapeLocation">270,2.5</av:Point>
        <av:Size x:Key="ShapeSize">60,75</av:Size>
        <av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 300,114.5</av:PointCollection>
      </scg4:Dictionary>
    </sap:WorkflowViewStateService.ViewState>
    <Flowchart.StartNode>
      <FlowStep x:Name="__ReferenceID2">
        <sap:WorkflowViewStateService.ViewState>
          <scg4:Dictionary x:TypeArguments="x:String, x:Object">
            <av:Point x:Key="ShapeLocation">200,114.5</av:Point>
            <av:Size x:Key="ShapeSize">200,51</av:Size>
            <av:PointCollection x:Key="ConnectorLocation">300,165.5 300,195.5 300,199</av:PointCollection>
          </scg4:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <TryCatch DisplayName="Orphan Sequence" sap:VirtualizedContainerService.HintSize="200,51">
          <TryCatch.Try>
            <Sequence sap:VirtualizedContainerService.HintSize="400,600">
              <sap:WorkflowViewStateService.ViewState>
                <scg4:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                </scg4:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <local:ShutdownWindowsService DisplayName="Shutdown Windows Svc" sap:VirtualizedContainerService.HintSize="242,22" ServiceIdentifier="[ServiceIdentifier]" />
              <InvokeMethod DisplayName="Delete Service Instance Record" sap:VirtualizedContainerService.HintSize="242,130" MethodName="DisassociateServiceInstanceWithCore">
                <InvokeMethod.TargetObject>
                  <InArgument x:TypeArguments="rp:ICoreDataProvider">[Reactor.Environment.Context.GridContext.CoreDataProvider]</InArgument>
                </InvokeMethod.TargetObject>
                <InArgument x:TypeArguments="s:Guid">[ServiceInstanceIdentifier]</InArgument>
              </InvokeMethod>
              <Assign sap:VirtualizedContainerService.HintSize="242,58">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">[TargetServiceInstallPath]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">[System.IO.Path.Combine(Reactor.Environment.Context.Configuration.GetConfigurationValue("Core.ServiceInstallsRootPath"), ServiceIdentifier.ToString())]</InArgument>
                </Assign.Value>
              </Assign>
              <local:UninstallAsWindowsService DisplayName="Uninstall Windows Svc" sap:VirtualizedContainerService.HintSize="242,22" TargetServiceInstallPath="[TargetServiceInstallPath]" />
              <Delay DisplayName="10 Second Delay" Duration="[TimeSpan.FromSeconds(10)]" sap:VirtualizedContainerService.HintSize="242,22" />
              <local:DeleteServiceDirectory sap:VirtualizedContainerService.HintSize="242,22" TargetServiceInstallPath="[TargetServiceInstallPath]" />
            </Sequence>
          </TryCatch.Try>
          <TryCatch.Catches>
            <Catch x:TypeArguments="s:Exception" sap:VirtualizedContainerService.HintSize="400,241">
              <sap:WorkflowViewStateService.ViewState>
                <scg4:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">False</x:Boolean>
                </scg4:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <ActivityAction x:TypeArguments="s:Exception">
                <ActivityAction.Argument>
                  <DelegateInArgument x:TypeArguments="s:Exception" Name="exception" />
                </ActivityAction.Argument>
                <Sequence sap:VirtualizedContainerService.HintSize="394,208">
                  <sap:WorkflowViewStateService.ViewState>
                    <scg4:Dictionary x:TypeArguments="x:String, x:Object">
                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                    </scg4:Dictionary>
                  </sap:WorkflowViewStateService.ViewState>
                  <local:ConstructOrphanFailureEvent sap:VirtualizedContainerService.HintSize="200,22" OrphanFailureException="[exception]" Result="[OrphanFailureEventMessage]" ServiceIdentifier="[ServiceIdentifier]" />
                  <rwa:SendMessage x:TypeArguments="rmefa:OrphanFailed" CorrelateWithCurrentWorkflowInstance="{x:Null}" Destinations="{x:Null}" DisplayName="Send OrphanFailed Event" sap:VirtualizedContainerService.HintSize="200,22" MessageToSend="[OrphanFailureEventMessage]" />
                </Sequence>
              </ActivityAction>
            </Catch>
          </TryCatch.Catches>
        </TryCatch>
        <FlowStep.Next>
          <FlowStep x:Name="__ReferenceID0">
            <sap:WorkflowViewStateService.ViewState>
              <scg4:Dictionary x:TypeArguments="x:String, x:Object">
                <av:Point x:Key="ShapeLocation">200,199</av:Point>
                <av:Size x:Key="ShapeSize">200,22</av:Size>
                <av:PointCollection x:Key="ConnectorLocation">300,221 300,249</av:PointCollection>
              </scg4:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <local:ConstructOrphanedEvent DisplayName="Construct Orphaned Event" sap:VirtualizedContainerService.HintSize="200,22" Result="[OrphanedEventMessage]" ServiceIdentifier="[ServiceIdentifier]" />
            <FlowStep.Next>
              <FlowStep x:Name="__ReferenceID1">
                <sap:WorkflowViewStateService.ViewState>
                  <scg4:Dictionary x:TypeArguments="x:String, x:Object">
                    <av:Point x:Key="ShapeLocation">200,249</av:Point>
                    <av:Size x:Key="ShapeSize">200,22</av:Size>
                  </scg4:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <rwa:SendMessage x:TypeArguments="rmea:ServiceOrphaned" CorrelateWithCurrentWorkflowInstance="{x:Null}" Destinations="{x:Null}" DisplayName="Send Orphaned Event" sap:VirtualizedContainerService.HintSize="200,22" MessageToSend="[OrphanedEventMessage]" />
              </FlowStep>
            </FlowStep.Next>
          </FlowStep>
        </FlowStep.Next>
      </FlowStep>
    </Flowchart.StartNode>
    <x:Reference>__ReferenceID0</x:Reference>
    <x:Reference>__ReferenceID1</x:Reference>
    <x:Reference>__ReferenceID2</x:Reference>
  </Flowchart>
</Activity>